<?php
class Empeval_Logger {
	
	/**
	 * 
	 * @var Zend_Log
	 */
	private $_logger = null;
	
	private $_config = null;
	
	public function __construct() {
		$this->_config = Core_Core::getInstance()->getConfigs()->log;
	}
	
	public function logException($e) {
		if ($e instanceof Core_Exception_Php)
			$config = $this->_config->php;
		else
			$config = $this->_config->app;
		$dir = Zend_Controller_Front::getInstance()->getModuleDirectory() . $config->dir . $e->getType() . '/' . date('Y') . '/' . date('m') . '/';
		Core_Tools::createDir($dir);
		$writer = new Zend_Log_Writer_Stream($dir . date('d') . $this->_config->fileExtension);
		$this->_logger = new Zend_Log($writer);
		$this->_logger->err($e, Zend_Log::INFO);
	}
	
}